#ifndef ALIHLTMUONMANSOTRACKSBLOCKSTRUCT_H
#define ALIHLTMUONMANSOTRACKSBLOCKSTRUCT_H
/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

// $Id: AliHLTMUONMansoTracksBlockStruct.h 36627 2009-11-10 19:21:49Z aszostak $

///
/// @file   AliHLTMUONMansoTracksBlockStruct.h
/// @author Artur Szostak <artursz@iafrica.com>
/// @date   21 May 2007
/// @brief  Definition the Manso tracks internal dimuon HLT data block.
///
/// The Manso tracks data block is an internal dimuon HLT data block structure
/// generated by the Manso algorithm.
/// The structures are defined with C linkage since C generally gives us more
/// binary compatibility between compilers.
///

#include "AliHLTMUONRecHitsBlockStruct.h"

extern "C"
{

/**
 * Track structure containing information about a partial track generated by
 * the Manso algorithm.
 */
struct AliHLTMUONMansoTrackStruct
{
	AliHLTInt32_t fId; // Each Manso track should have an ID number unique
	                   // for a given event. -1 == invalid.

	AliHLTInt32_t fTrigRec; // The associated trigger record ID used as the
	                        // seed for the Manso algorithm.

	// The flags word constains the following bit fields (bit 31 is most
	// significant):
	// bits:  [31][30][29 --- 4][  3   ][  2   ][  1   ][  0   ]
	// field:  -   +   reserved  hst[3]  hst[2]  hst[1]  hst[0]
	// Where fields hst[i] indicates if fHit[i] has been filled/set.
	// Reserved bits should be set to zero.
	// Particle sign: if '-' is set then particle has minus sign.
	//                if '+' is set then particle has negative sign.
	// Either '+' or '-' should be set and if neither then the particle
	// sign is unknown.
	AliHLTUInt32_t fFlags;

	AliHLTFloat32_t fPx; // Particle's momentum X component in GeV/c.
	AliHLTFloat32_t fPy; // Particle's momentum Y component in GeV/c.
	AliHLTFloat32_t fPz; // Particle's momentum Z component in GeV/c.
	AliHLTFloat32_t fChi2; // The chi squared of the fit of fHit points to
	                       // the track model. If -1 then no fit done and
	                       // momentum vector is invalid.

	// Particle hit coordinates on tracking chambers 7 to 10.
	// fHit[0] is for chamber 7 fHit[1] for chamber 8 etc...
	AliHLTMUONRecHitStruct fHit[4];
};

/**
 * AliHLTMUONMansoTracksBlockStruct defines the format of the internal
 * Manso tracks data block.
 */
struct AliHLTMUONMansoTracksBlockStruct
{
	AliHLTMUONDataBlockHeader fHeader; // Common data block header.

	// Array of Manso tracks.
	//AliHLTMUONMansoTrackStruct fTrack[/*fHeader.fNrecords*/];
};

} // extern "C"


/**
 * Stream operator for usage with std::ostream classes which prints the track
 * information in the following format:
 *  {fId = xx, fTrigRec = yy, fFlags = 0xZZ, fPx = uu, fPy = vv, fPz = ww,
 *   fChi2 = ss, fHit[0] = {...}, fHit[1] = {...}, fHit[2] = {...},
 *   fHit[3] = {...}}
 */
std::ostream& operator << (
		std::ostream& stream, const AliHLTMUONMansoTrackStruct& trigrec
	);

/**
 * Stream operator for usage with std::ostream classes which prints the
 * AliHLTMUONMansoTracksBlockStruct in the following format:
 *   {fHeader = xx, fTrack[] = [{..}, {..}, ...]}
 */
std::ostream& operator << (
		std::ostream& stream, const AliHLTMUONMansoTracksBlockStruct& block
	);


inline bool operator == (
		const AliHLTMUONMansoTrackStruct& a,
		const AliHLTMUONMansoTrackStruct& b
	)
{
	return a.fId == b.fId and a.fTrigRec == b.fTrigRec
		and a.fFlags == b.fFlags and a.fPx == b.fPx and a.fPy == b.fPy
		and a.fPz == b.fPz and a.fChi2 == b.fChi2
		and a.fHit[0] == b.fHit[0] and a.fHit[1] == b.fHit[1]
		and a.fHit[2] == b.fHit[2] and a.fHit[3] == b.fHit[3];
}

inline bool operator != (
		const AliHLTMUONMansoTrackStruct& a,
		const AliHLTMUONMansoTrackStruct& b
	)
{
	return not operator == (a, b);
}


bool operator == (
		const AliHLTMUONMansoTracksBlockStruct& a,
		const AliHLTMUONMansoTracksBlockStruct& b
	);

inline bool operator != (
		const AliHLTMUONMansoTracksBlockStruct& a,
		const AliHLTMUONMansoTracksBlockStruct& b
	)
{
	return not operator == (a, b);
}

#endif // ALIHLTMUONMANSOTRACKSBLOCKSTRUCT_H
